package com.project.fortuneteller.controller;


import com.project.fortuneteller.pojo.vo.PlumBlossomVo;
import com.project.fortuneteller.service.DivinatoryDetailsService;
import com.project.fortuneteller.service.DivineWayService;
import com.project.fortuneteller.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;
import java.util.BitSet;

/**
 * 占卜 演示板块
 *    四种占卜 方式
 */
@Slf4j
@CrossOrigin
@RestController
@RequestMapping
public class DivineController {
    @Autowired
    private DivineWayService divineWayService;

    @Autowired
    private DivinatoryDetailsService divinatoryDetailsService;
    /**
     * 基本 64 卦的 推导
     * @param target
     * @return
     */

    @RequestMapping("/divine")
    public Result getByDivine(String target ) {
        log.info("target:{}", target);
        return divineWayService.getByDivine(target);
    }
    /**
     * 大衍噬法的模拟
     * @return
     */
    @RequestMapping("/deduction")
    @ResponseBody
    public Result getDeductionImitate() {
        return divineWayService.getDeductionImitate();
    }
    /**
     * 金钱卦 占卜方式的代码模拟实现
     * @return
     */
    @RequestMapping("/money")
    public Result geMoneyImitate() {
        return divineWayService.getMoneyImitate();
    }
    /**
     * 梅花易数 占卜方式的代码模拟实现
     * @return
     */
    @RequestMapping("/plumBlossom")
    public Result getPlumBlossomImitate( @RequestBody PlumBlossomVo plumBlossomVo) throws ParseException {
        return divineWayService.getPlumBlossomImitate(plumBlossomVo);
    }

}
